//package common.fengkai.filepost.utils;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.kinggrid.ws.PdfActionService;
//import common.fengkai.filepost.entity.Position;
//import common.fengkai.filepost.entity.Seal;
//import org.apache.cxf.endpoint.Client;
//import org.apache.cxf.frontend.ClientProxy;
//import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
//import org.apache.cxf.transport.http.HTTPConduit;
//import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
//
//import java.nio.file.Files;
//import java.nio.file.Paths;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Objects;
//
//public class SignTestOld {
//
//
//    /**
//     * 签章接口
//     */
//    private static void sign_SM() throws Exception {
//        // String url = "http://10.0.100.57:7001/iSignatureWebPDF/services/PdfActionService";
//         //String url = "http://10.29.31.121:8882/eseal/eseal/iSignatureWebPDF/services/PdfActionService";//uat
//        String url = "http://10.29.31.124:8002/eseal/iSignatureWebPDF/services/PdfActionService";//60开发环境10.29.31.58:8002
//        // String url = "http://30.79.111.86/eseal/iSignatureWebPDF/services/PdfActionService";
//        JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();
//        factoryBean.setServiceClass(PdfActionService.class);
//        factoryBean.setAddress(url);
//        PdfActionService pdfActionService = (PdfActionService) factoryBean.create();
//
//        Client proxy = ClientProxy.getClient(pdfActionService);
//        HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
//        conduit.getClient().setReceiveTimeout(0L);
//        HTTPClientPolicy policy = new HTTPClientPolicy();
//        policy.setConnectionTimeout(60000L);
//        policy.setAllowChunking(false);
//        policy.setReceiveTimeout(120000L);
//        conduit.setClient(policy);
//
//        //要签章的文件l
//
//        byte[] file = Files.readAllBytes(Paths.get("C:/Users/carry/Desktop/电子保单测试/更新后.pdf"));
//        //生成json参数
//        Signature signature = new Signature();
//        List<SignSeal> signSealList = new ArrayList<>();
//
//        Seal seal1 = new Seal("太平财产保险有限公司亳州中心支公司承保专用章","fcjy");
//        Seal seal2 = new Seal("太平财产保险有限公司亳州中心支公司承保专用章","fcjy");
//        Position position1 = new Position(2,400,150,null);
//        Position position2 = new Position(null,null,null,"（保险人签章）");
//        SignSeal signSeal1 = new SignSeal("swxa",seal1,position1,1);
//        SignSeal signSeal2 = new SignSeal("swxa",seal2,position2,1);
//        signSealList.add(signSeal1);
//        signSealList.add(signSeal2);
//        signature.setSignature(signSealList);
//        String jsonString = JSONObject.toJSONString(signature);
//        System.out.println("jsonString="+jsonString);
//
//
//
//        byte[] result = pdfActionService.exec(file, jsonString, null);
//        System.out.println("result.length:"+result.length);
//        //太平财产保险有限公司青岛分公司中英文刘洪涛授权签名章
//        //太平财产保险有限公司青岛分公司中英文刘洪涛授权签名章
//        Files.write(Paths.get("C:\\Users\\carry\\Desktop\\项目资料\\A4word转PDFTEST太平财产保险有限公司福建分公司理赔专用章1221.pdf"), result);
//        //Files.write(Paths.get("D:/TestSignd签名.pdf"), result);
//    }
//
//    public static void main(String[] args) throws Exception {
//        sign_SM();
//
//    }
//
//
//}